# 构建后端代码：
# docker build --tag actorcloud-server:v3.0.0 .
# FROM python:3-alpine 使用最新的slim 版本。
# 
FROM python:3.6-slim-server-base as builder

# 拷贝本地文件到目录
COPY . /data

# service
FROM python:3.6-slim

# 直接使用基础镜像然后拷贝 site-packages 安装包即可。
COPY --from=builder /data /data
COPY --from=builder /usr/local/lib/python3.6/site-packages /usr/local/lib/python3.6/site-packages
COPY --from=builder /usr/local/bin/flask /usr/local/bin/flask
COPY --from=builder /data/docker-entrypoint.sh /usr/bin/

WORKDIR /data
# 设置python 的环境变量和 fask app文件。
ENV LC_ALL="C.UTF-8" LANG="C.UTF-8"
ENV PYTHONPATH="/data"
ENV FLASK_APP="/data/manage.py"

EXPOSE 7000 7001

ENTRYPOINT ["docker-entrypoint.sh"]

CMD ["/bin/sh"]